package com.bruce.commonutils;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by wangzhijie@wind-mobi.com on 2015/9/1.
 */
public class RxUtils {
    private final static Observable.Transformer<Observable, Observable> t =
            new Observable.Transformer<Observable, Observable>() {
                @Override
                public Observable<Observable> call(Observable<Observable> Observable) {
                    return Observable.subscribeOn(Schedulers.io())
                            .observeOn(AndroidSchedulers.mainThread());
                }
            };
    @SuppressWarnings("unchecked")
    public static <T> Observable.Transformer<T, T> applySchedulers() {
        return (Observable.Transformer<T, T>) t;
    }


    public static class AB<A, B> {
        public A a;
        public B b;
    }

    public  static <A, B> AB<A, B> createAB(A a, B b) {
        AB<A, B> bundle = new AB<A, B>();
        bundle.a = a;
        bundle.b = b;
        return bundle;
    }

    public static class ABC<A, B,C> {
        public A a;
        public B b;
        public C c;
    }

    public  static <A, B,C> ABC<A, B,C> createABC(A a, B b, C c) {
        ABC<A, B,C> bundle = new ABC<A, B, C>();
        bundle.a = a;
        bundle.b = b;
        bundle.c = c;
        return bundle;
    }
}
